package com.maimao.cart.client;

import com.maimao.cart.client.factory.GoodsFallBackFactory;
import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.Result;
import com.maimao.model.goods.vo.GoodsInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 7:54 下午
 */
@RequestMapping("/goods/goods")
@FeignClient(contextId = "goodsClient", value = ServiceContainer.GOODS_SERVICE, fallbackFactory = GoodsFallBackFactory.class, configuration = FeignInterceptor.class)
public interface GoodsClient {

    /**
     * 检查sku是否有效
     */
    @GetMapping("/client/checkSku")
    Result<Boolean> checkSku(@RequestParam("skuId") Long skuId);

    /**
     * 批量检查sku是否有效（商品是否下架 库存是否大于0且满足下单量）返回无效的skuID
     *
     * @return
     */
    @PostMapping("/check-sku-batch-res")
    Result<List<Long>> checkSkuBatchWithRes(@RequestBody List<Long> skuIds);
}
